package com.xgk.boot.module.core.service.order;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xgk.boot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xgk.boot.module.core.dal.entity.order.OrderAddressDO;
import com.xgk.boot.module.core.dal.mapper.order.OrderAddressMapper;
import com.xgk.boot.module.core.dal.iservice.order.OrderAddressService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 订单收件地址信息 服务实现类
 * </p>
 *
 * @author yfbao
 * @since 2025-06-14
 */
@Service
public class OrderAddressServiceImpl extends ServiceImpl<OrderAddressMapper, OrderAddressDO> implements OrderAddressService {

    //通过订单code获取对应地址信息
    public OrderAddressDO getByOrderCode(String orderCode) {
        LambdaQueryWrapperX<OrderAddressDO> eq = new LambdaQueryWrapperX<OrderAddressDO>().eq(OrderAddressDO::getOrderCode, orderCode);
        return this.getOne(eq);
    }

    /**
     * 通过订单id获取订单收件地址
     */
    public OrderAddressDO getByOrderId(Long orderId) {
        LambdaQueryWrapperX<OrderAddressDO> eq = new LambdaQueryWrapperX<OrderAddressDO>().eq(OrderAddressDO::getOrderId, orderId);
        return this.getOne(eq);
    }

}
